//http://118.89.111.124:8080/dqapp/activities/12313/applicants/123123
import React from 'react';

import CommonRequestDataAction from '../common/CommonRequestDataAction';
import Constants from '../../common/Constants';
import ResponseConstants from '../../common/ResponseConstants';

export default class ActivityRequestOneApplicantAction extends CommonRequestDataAction {
  constructor() {
    super();

    this.moduleType = Constants.MODULE_TYPE.ACTIVITY;
    this.name = "ActivityRequestOneApplicantAction";
  }

  _dealCall(caller, data) {
    caller.setState({
      viewStatus: 2,
    })
  }

  finish(data, isSucceed, response) {
    if(isSucceed) {
      this.caller.setState({
        viewStatus: 3,
        is_liked: data.is_liked,
        applicantData: data.links.applicant,
        loadDataSuccess:true,
      })
    }
    else if (data) {
      if(data.status == ResponseConstants.status_unauthorized) {
        this._dealUnauthorized(this.caller);
      }
      else {
        this.caller.setState({viewStatus: data.status})
      }
    }
    else {
      this.caller.setState({viewStatus: 400})
    }
  }
  // DqappViewed_applicant {
  //   is_liked (integer): 用户是否已点赞，0否，1是 = ['0', '1'],
  //   links (DqappViewed_applicantLinks, optional)
  // }
  // DqappApplicantDetail {
  //   applicant_id (string, optional): 报名编号 ,
  //   avatar_url (string, optional): 头像 ,
  //   content (string, optional): 报名宣言 ,
  //   ee_no (integer, optional): 报名员工编号 ,
  //   likers_num (integer, optional): 点赞数 ,
  //   media_url (string, optional): 媒体地址 ,
  //   name (string, optional): 报名员工名字
  // }
}
